﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using OnlineOpinionAnalysis.Server.Services;

namespace OnlineOpinionAnalysis.Server.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class BiliVideoController : ControllerBase
    {    
        public IBiliVideoService BiliVideoService { get; set; }

        public BiliVideoController(IBiliVideoService biliVideoService)
        {
            BiliVideoService = biliVideoService;
        }

        // 设置获取视频数据的请求
        [HttpGet]
        public async Task<List<BiliVideo>> GetBiliVideos(int number=100)
        {
            var result = await BiliVideoService.GetVideo(number);
            return result;
        }

        [HttpGet("{tid}")]
        public async Task<List<BiliVideo>> GetBiliVideosByTid(int Tid,int number = 100)
        {
            var result = await BiliVideoService.GetVideoByTid(Tid,number);
            return result;
        }

        [HttpGet("count")]
        public async Task<int> GetBiliVideoCount()
        {
            int count=await BiliVideoService.GetVideoCount();
            return count;
        }
    }
}
